<div id="ContentMessage">
	<div id="NoteContentMessage">
		<?php echo $get_message_notnull ?>
	</div>
	
	<div id="ErrorContentMessage">
		<?php echo $lbl_error_msg; ?>
	</div>
</div>		
<form  name='form_main' id="form_main" method="post" action="<?php echo $link_page; ?>" enctype="multipart/form-data">	
<div id="SiteContent_main">			
	
	
	<div id="EditContent">
		<table class="EditStyle01" >
			<tbody>		
				<tr>
					<td class="key" style="width:150px">
					<?php echo $lbl_ccode; ?><?php echo $get_icon_notnull; ?>					</td>
					<td style="width:210px">
						<input style="width:200px;" type="text" width="" name="txt_ccode" value="<?php echo $txt_ccode; ?>">					
					</td>
					<td class="key" style="width:150px"><?php echo $lbl_nid_metarial_product; ?><?php echo $get_icon_notnull; ?></td>
					<td>
						<?php 
							$url = base_url().'index.php/do_product/load_cbo_cat_product/'; 
							if($cbo_nid_cat_products != '')
								$url .= $nid.'/';
							else 
								$url .= '0/';
						?>
						<select name="cbo_nid_material_products" style="width:200px" id="cbo_nid_material_products" >
							<option value=""><?php echo $lbl_choose_metarial_product ?></option>
							<?php foreach($material_product_view as $data): ?>	
							<option <?php if($data['nid'] == $cbo_nid_material_products){echo 'selected="selected"';} ?> value="<?php echo $data['nid'] ?>"><?php echo $data['cmaterial_products'] ?></option>
							<?php endforeach; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="key">
					<?php echo $lbl_cproducts; ?><?php echo $get_icon_notnull; ?>					</td>
					<td>
						<input style="width:200px;" type="text" width="" name="txt_cproducts" value="<?php echo $txt_cproducts; ?>">					
					</td>
					<td class="key">
					<?php echo $lbl_nid_cat_product; ?><?php echo $get_icon_notnull; ?></td>
					<td>
						<div id="cnid_cat_products">
							<select id="cbo_nid_cat_products" name="cbo_nid_cat_products" style="width:200px;">
								<option></option>
							</select>
						</div>
					</td>
				</tr>	
				<tr>
					<td class="key">
					<?php echo $lbl_fprice; ?> 					
					</td>
					<td>
						<input style="width:200px;" type="text" name="txt_fprice" value="<?php echo $txt_fprice; ?>"/> 			
					</td>
					<td class="key">
					<?php echo $lbl_nid_brand_product; ?> 					
					</td>
					<td>
						<div id="dv_brand">
							<select name="nid_brand_products" id="nid_brand_products"  style="width:200px;">
								<option></option>
							</select>
						</div>	 	 			
					</td>
				</tr>						
				<tr>
					<td class="key">
						<?php echo $lbl_fprice_sale; ?>	
					</td>
					<td>
						<input style="width:200px;" type="text" name="txt_fprice_sale" value="<?php echo $txt_fprice_sale; ?>"/>
					</td>
					
					<td class="key">
						<?php echo $lbl_nstatus; ?>	
					</td>
					<td><?php echo $gen_cbo_status ?></td>
				</tr>
				<tr style="display:none">
					<td class="key">
					<?php echo $lbl_cnote; ?></td>
					<td>
						<textarea style="width:200px; height:50px" name="txt_cnote"><?php echo $txt_cnote; ?></textarea>	
					</td>
					<td class="key"><?php echo $lbl_tag; ?>	</td>
					<td><textarea style="width:200px; height:50px" name="txt_ctag"><?php echo $txt_ctag; ?></textarea></td></td>
				</tr>
			
			<tbody>				
		</table>
		<table class="EditStyle01" style="width:830px;">
			<tr>
				<td class="key" style="width:150px"><?php echo $lbl_cindex; ?></td>
				<td ><input style="width:200px;" type="text" maxlength="4" name="txt_cindex" value="<?php echo $txt_cindex; ?>"/>	 	</td>
			</tr>
			<tr>
				<td class="key" style="width:150px"><?php echo $lbl_cdescription; ?></td>
				<td style="height:200px;"><?php echo $this->fckeditor->Create('txt_cdescription',$txt_cdescription,'Basic') ?></td>
			</tr>
			<tr  style="display:none">
				<td class="key" style="width:150px"><?php echo $lbl_cpower; ?></td>
				<td style="height:200px;"><?php echo $this->fckeditor->Create('txt_cpower',$txt_cpower,'Basic') ?></td>
			</tr>
			<tr>
				<td class="key" style="width:150px"><?php echo 'Chi tiết'; ?></td>
				<td style="height:400px;"><?php echo $this->fckeditor->Create('txt_cdetail',$txt_cdetail,'Basic') ?></td>
			</tr>
			<tr style="display:none">
				<td class="key">
				<?php echo $lbl_nspecial_product; ?></td>
				<td>
					<input type="checkbox" <?php if($chk_nspecial_product == 1) echo 'checked="checked"'; ?>  name="chk_nspecial_product" id="chk_nspecial_product" value="1" />					
				</td>
			</tr>
			<tr>
				<td class="key" style="width:150px"><?php echo $lbl_cimage; ?><?php echo $get_icon_notnull; ?></td>
				<td>
					<div style="position:relative">
						<input name="txt_cimage" type="file" id="txt_cimage" value ="" size="25" style="width:400px;"/>
						<p style="color:#FF0000"><b>Chú ý</b>: Chỉ upload các hình có định dạng: gif, png, jpg và có kích thước chuẩn là rộng: 600px, cao: 476px </p>
						<?php if($txt_cimage != ''): ?>
						<img  width="160" style="position:absolute; top:0px; right:-155px;" src="<?php echo $fr_img.'upload/images_product/full_images/'.$txt_cimage; ?>"/>
						<?php endif; ?>
					</div>
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td>
					<input type="button" name="btn_submit" style="width:80px;" value ="<?php echo $btn_update; ?>" 
						onclick ="js_SetSubmitButtonClick(this.form, this.name);" class="button"/>
												   
					<input name="btn_cancel" style="width:80px;" type="button" 
						   value = "<?php echo $btn_cancel; ?>"
						   onclick="location.href='<?php echo $link_cancel; ?> '" class="button"/>					
				</td>
			</tr>
		</table>
	</div>
	<input name="hidden_nid" type="hidden" value = "<?php echo $nid; ?>"  />
	<input name="hidden_event" type="hidden" value = "<?php echo $event; ?>"  />
	<input name="hidden_image_old" type="hidden" value = "<?php echo $txt_cimage; ?>"  />
	<input name="hidden_image_old_resize" type="hidden" value = "<?php echo $txt_cimage_resize; ?>"  />
	<input type="hidden" name="hidden_button_click"  value = "" />	
</div>
</form>

<!-- BAT BUOC CAC FORM NHAP LIEU DEU PHAI DUNG SCRIPT NAY. -->

<script type="text/javascript" >
function js_SetSubmitButtonClick(obj_form, btn_name) 
	{
		obj_form.hidden_button_click.value = btn_name;
		obj_form.submit();		
	}	
$('#cbo_nid_material_products').change(function() {
	_nid_cat =this.value;
	$("#cnid_cat_products").html('loading...');
 	$.post("<?php echo base_url().'index.php/do_product/ajax_get_product_cat/'?>", { nid_cat: _nid_cat},
  	function(data) {
		$("#cnid_cat_products").html(data);
  	});
});
load_cat();
load_brand();
function load_cat()
{
	_nid_sec ='<?php echo $cbo_nid_material_products?>';
	_nid_cat='<?php echo $cbo_nid_cat_products?>';
	
	if(_nid_cat !='')
	{
		$.post("<?php echo base_url().'index.php/do_product/ajax_get_product_cat_select/'?>", { nid_cat: _nid_sec,nid_cat_select:_nid_cat},
		function(data) {
		
			$("#cnid_cat_products").html(data);
		});
	}
}

function load_brand_select(nid_cat)
{
		_nid_cat =nid_cat;
		$("#dv_brand").html('loading...');
		$.post("<?php echo base_url().'index.php/do_product/ajax_get_product_brand/'?>", { nid_cat: _nid_cat},
		function(data) {
			$("#dv_brand").html(data);
		});	
}
function load_brand()
{
	_nid_sec ='<?php echo $cbo_nid_cat_products?>';
	_nid_cat='<?php echo $nid_brand_products?>';
	if(_nid_cat !='')
	{
	
		$.post("<?php echo base_url().'index.php/do_product/ajax_get_product_brand_select/'?>", { nid_cat: _nid_sec,nid_cat_select:_nid_cat},
		function(data) {
			$("#dv_brand").html(data);
		});
	}
}
</script>